﻿
<MudRTLProvider RightToLeft="@SharedLayoutSettings.IsRTL">
    <MudDialog>
        <DialogContent>
            <MudCard Class="mt-2">
                <MudPaper Elevation="3" Class="" Outlined="true" Square="true">
                    <MudToolBar Dense>
                        <MudText Typo="Typo.button" Color="Color.Primary">
                            @DashboardResource.StringSearch
                        </MudText>
                        <MudSpacer />
                        <MudIconButton OnClick="Search" Icon="@Icons.Material.Filled.ManageSearch" Color="Color.Tertiary" title="@DashboardResource.StringSearch" />
                        <MudIconButton OnClick="Close" Icon="@Icons.Material.Filled.Close" Color="Color.Error" title="@DashboardResource.StringCancel" />
                    </MudToolBar>
                </MudPaper>
                <MudCardContent>
                    <MudGrid>
                        <MudItem md="12">
                            <MudTextField @bind-Value="FilterViewModel.Version" Variant="Variant.Outlined"
                                          Adornment="Adornment.Start" AdornmentIcon="@Icons.Material.Filled.FilterDrama" Clearable
                                          For="@(() => FilterViewModel.Version)"
                                          Label="@DashboardResource.StringVersion" />
                        </MudItem>
                    </MudGrid>
                </MudCardContent>
            </MudCard>          
        </DialogContent>
    </MudDialog>
</MudRTLProvider>

@code {

    [CascadingParameter]
    public MudDialogInstance MudDialog { get; set; }

    private void Close() => MudDialog.Close();

    // *****************************************************

    private async Task Search()
    {
        await Task.Delay(100);

        MudDialog.Close(DialogResult.Ok(FilterViewModel));
    }

    [Parameter]
    public FilterReleaseViewModel FilterViewModel { get; set; } = new();

}
